package project.menu.garagemenu;

import project.controllers.Messager;
import project.controllers.Printer;
import project.menu.IMenu;
import project.menu.IMenuItem;
import project.work.Navigator;
import controllers.IAutoservice;

public class ListFreeGarage implements IMenuItem{
	private String name = "Get number free garage";
	private final Integer id=1;
	private static IMenu submenu;	
	private Navigator navigator;
	
	
	public ListFreeGarage(){
		navigator= Navigator.getInstance();
	}
	
	
	public static void setSubmenu(IMenu menu){
		 submenu=menu;
	}
	
	public Integer getId() {
		return id;
	}
	
	public String getNameItem(){
		return name;
	}

	
	public void action(IAutoservice autoservice) {
		int numberPlace=autoservice.getEmptyGarage();
		Printer.printMessage(numberPlace+Messager.NUMBER_GARAGE);		
		navigator.drawMenu(submenu);
	}
	
		

}
